/* $Id:guild.h $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#ifndef __GUILD_H
#define __GUILD_H

#include <string>
#include <map>
#include <list>
using namespace std;

#include "skill_level.h"
#include "person.h"
#include "army.h"

#define loopGuildSkills(r,v) loopMap((r)->listSkills(),v,class skill_level)
#define loopGuildMembers(r,v) loopMap((r)->listMembers(),v,class person)
#define loopGuildArmies(r,v) loopMap((r)->listArmies(),v,class army)

class guild {
    string name;
    string description;
    map<string,class skill_level> skills;
    class skill *deity;
    map<string,class person> members;
    map<string,class army> armies;
public:
    guild();

    // Field : name
    const string getName() const;
    void setName(const string v);

    // Field : description
    const string getDescription() const;
    void setDescription(const string v);

    // Field : skills
    class skill_level& getSkills(const string v);
    map<string,class skill_level>& listSkills();
    void setSkills(class skill_level &v);
    void delSkills(const string v);
    const bool isSkills(const string v) const;

    // Field : deity
    class skill& getDeity() const;
    void setDeity(class skill &v);

    // Field : members
    class person& getMembers(const string v);
    map<string,class person>& listMembers();
    void setMembers(class person &v);
    void delMembers(const string v);
    const bool isMembers(const string v) const;

    // Field : armies
    class army& getArmies(const string v);
    map<string,class army>& listArmies();
    void setArmies(class army &v);
    void delArmies(const string v);
    const bool isArmies(const string v) const;

    void save(class channel &ch);
    void load(class channel &ch);
    void xml(ofstream &f, int l=0, int r=0);
};

#endif // __GUILD_H
